package org.linphone.http;

import android.util.Log;

/**
 * @Author LD
 * @Time 2019/11/12 9:28
 * @Describe 日志工具
 *           使用：LogUtil.d("TAG","debug log")
 *           开发阶段：将level写为VERBOSE 上线时将level写为NOTHING即可屏蔽掉所有的log日志
 * @Modify
 */
public class LogUtil {
    public static final int VERBOSE = 1;
    public static final int DEBUG = 2;
    public static final int INFO = 3;
    public static final int WARN = 4;
    public static final int ERROR = 5;
    public static final int NOTHING = 6;

    public static int level = VERBOSE;

    public static void v(String tag, String msg) {
        if (level <= VERBOSE) {     //只有当level的值小于或等于对应日志级别值的时候，才会将日志打印出来
            Log.v(tag, msg);
        }
    }

    public static void d(String tag, String msg) {
        if (level <= DEBUG) {
            Log.d(tag, msg);
        }
    }

    public static void i(String tag, String msg) {
        if (level <= INFO) {
            Log.i(tag, msg);
        }
    }

    public static void w(String tag, String msg) {
        if (level <= WARN) {
            Log.w(tag, msg);
        }
    }

    public static void e(String tag, String msg) {
        if (level <= ERROR) {
            Log.e(tag, msg);
        }
    }
}
